package com.billow.events
{
	import com.billow.net.Client;
	
	import flash.events.Event;
	import flash.utils.ByteArray;
	
	public class ClientEvent extends Event
	{
		/** 连接成功 */
		public static const CONNECT_SUCCEED:String = "connectSucceed";
		/** 连接服务器失败 */
		public static const CONNECT_FAILED:String = "connectFailed";
		/** 接收服务器数据 */
		public static const RECEIVE:String = "receive";
		/** 数据加载中 */
		public static const PROGRESS:String = "progress";
		/** 数据读取失败 */
		public static const IO_ERROR:String = "ioError";
		
		private var _client:Client;
		
		public function ClientEvent(type:String, client:Client=null, bubbles:Boolean=false, cancelable:Boolean=false)
		{
			super(type, bubbles, cancelable);
			_client = client;
		}
		
		/** 参数 */
		public function get data():ByteArray {return target.data;}
		/** 命令 */
		public function get cmd():String {return target.cmd;}
		/** 数据包已加载字节 */
		public function get bytesLoaded():Number {return target.bytesLoaded;}
		/** 数据包总字节 */
		public function get bytesTotal():Number {return target.bytesTotal;}
	}
}